﻿namespace Sidvall.Office
{
    public class WorksheetColumn : Sidvall.Office.IWorksheetColumn
    {
        #region Public Members

        #region CellFormat

        private IWorksheetCellFormat _CellFormat;
        public IWorksheetCellFormat CellFormat
        {
            get
            {
                if (_CellFormat == null)
                    _CellFormat = new WorksheetCellFormat(this.InternalWorksheetColumn.CellFormat);
                return _CellFormat;
            }
        }

        #endregion
        #region Hidden

        public bool Hidden
        {
            get
            {
                return this.InternalWorksheetColumn.Hidden;
            }
            set
            {
                this.InternalWorksheetColumn.Hidden = value;
            }
        }

        #endregion
        #region Width

        public int Width
        {
            get
            {
                return this.InternalWorksheetColumn.Width;
            }
            set
            {
                this.InternalWorksheetColumn.Width = value;
            }
        }

        #endregion

        #region SetWidth

        public void SetWidth(double value, WorksheetColumnWidthUnit units)
        {
            this.InternalWorksheetColumn.SetWidth(value, Excel.GetWorksheetColumnWidthUnit(units));
        }

        #endregion
        #region ToString

        public override string ToString()
        {
            return "WorksheetColumn - Sidvall.Office.IG";
        }

        #endregion

        #endregion
        #region Private Members

        internal Infragistics.Documents.Excel.WorksheetColumn InternalWorksheetColumn { get; set; }

        #endregion
        #region Constructors

        public WorksheetColumn(Infragistics.Documents.Excel.WorksheetColumn worksheetColumn)
        {
            this.InternalWorksheetColumn = worksheetColumn;
        }

        #endregion
    }
}
